package week08;
//package test;

import java.util.HashSet;
import java.util.Set;
import java.util.*;
public class pta2 {
	public static void main(String[] args) {
		int num=0;
		Set<String> setword =new TreeSet<>();
		Scanner sc = new Scanner(System.in );
	   while(true){
		String  word  =sc.next();
		if(word.equals("!!!!!"))
			break;
		setword.add(word);
			
	}
	   System.out.println(setword.size());
	  for(String e :setword){
		  System.out.println(e);
		  num++;
		  if(num==10)
			  break;
	   }
		
	}

	

}
